﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xant.FlowEngine.Core;
using Xant.FlowEngine.Interface;

namespace Xant.FlowEngine.Actor
{
    /// <summary>
    /// 组参与者
    /// <remarks>该组内所有员工都将获得参与权</remarks>
    /// </summary>
    public class GroupActor : AbstractActor
    {
        private IGroup group;

        public GroupActor(IGroup group)
        {
            this.group = group;
        }

        public override string Text
        {
            get { return group.Name; }
        }

        public override string ToXml()
        {
            var xml = string.Format("<Actor Type=\"{0}\" Key=\"{1}\" />", this.Type, group.Id);
            return xml;
        }

        public override IEnumerable<IStaffMember> GetStaffs()
        {
            return group.StaffMembers;
        }

    }

}
